$datepicker-trigger-icon-width: var(--rz-icon-size) !default;
$datepicker-trigger-icon-height: $datepicker-trigger-icon-width !default;
$datepicker-trigger-icon-color: var(--rz-text-secondary-color) !default;
$datepicker-trigger-icon-hover-color: var(--rz-secondary) !default;
$datepicker-line-height: 1.25rem !default;

$datepicker-panel-border: var(--rz-border-normal) !default;
$datepicker-panel-background-color: var(--rz-base-background-color) !default;
$datepicker-panel-shadow: 0 6px 14px 0 rgba(0, 0, 0, 0.06) !default;
$datepicker-panel-margin: 0 !default;
$datepicker-header-background-color: var(--rz-base-200) !default;
$datepicker-header-color: var(--rz-text-secondary-color) !default;
$datepicker-header-padding: 0 1rem !default;
$datepicker-header-line-height: 2.8125rem !default;
$datepicker-header-border: none !default;
$datepicker-footer-padding: 0 1rem !default;
$datepicker-footer-line-height: 2.8125rem !default;

$datepicker-calendar-padding: 0.5rem 0.875rem !default;
$datepicker-calendar-header-font-size: 0.625rem !default;
$datepicker-calendar-header-text-transform: uppercase !default;
$datepicker-calendar-header-color: var(--rz-text-tertiary-color) !default;
$datepicker-calendar-font-size: var(--rz-body-font-size) !default;
$datepicker-calendar-color: var(--rz-text-color) !default;
$datepicker-calendar-hover-color: var(--rz-text-contrast-color) !default;
$datepicker-calendar-hover-background-color: var(--rz-secondary-light) !default;
$datepicker-calendar-selected-color: var(--rz-text-contrast-color) !default;
$datepicker-calendar-selected-background-color: var(--rz-secondary-dark) !default;
$datepicker-calendar-selected-hover-color: var(--rz-text-contrast-color) !default;
$datepicker-calendar-selected-hover-background-color: var(--rz-secondary) !default;
$datepicker-calendar-border: var(--rz-border-base-100) !default;
$datepicker-calendar-border-radius: 0 !default;
$datepicker-calendar-transition: var(--rz-transition-all) !default;

$datepicker-calendar-today-color: var(--rz-secondary) !default;
$datepicker-calendar-today-background-color: transparent !default;
$datepicker-calendar-today-box-shadow: none !default;
$datepicker-calendar-today-border-radius: var(--rz-datepicker-calendar-border-radius) !default;

$datepicker-title-height: 47px !default;

$timepicker-background-color: var(--rz-base-200)!default;
$timepicker-color: var(--rz-text-color) !default;
$timepicker-padding: 0.5rem !default;
$timepicker-hour-padding: 0.5rem !default;
$timepicker-button-background-color: var(--rz-secondary) !default;
$timepicker-button-color: var(--rz-text-contrast-color) !default;
$timepicker-button-width: 0.875rem !default;
$timepicker-button-height: $timepicker-button-width !default;
$timepicker-button-border-radius: 2px !default;
$timepicker-button-padding: 0.5rem 1rem !important;
$timepicker-gap: 0.5rem !default;
$timepicker-separator-color: var(--rz-text-color) !default;
$timepicker-separator-margin: 0 0.5rem !default;
$timepicker-border: none !default;

// DatePicker CSS variables

:root {
  --rz-datepicker-trigger-icon-width: #{$datepicker-trigger-icon-width};
  --rz-datepicker-trigger-icon-height: #{$datepicker-trigger-icon-height};
  --rz-datepicker-line-height: #{$datepicker-line-height};
  --rz-datepicker-trigger-icon-color: #{$datepicker-trigger-icon-color};
  --rz-datepicker-trigger-icon-hover-color: #{$datepicker-trigger-icon-hover-color};

  --rz-datepicker-panel-border: #{$datepicker-panel-border};
  --rz-datepicker-panel-background-color: #{$datepicker-panel-background-color};
  --rz-datepicker-panel-shadow: #{$datepicker-panel-shadow};
  --rz-datepicker-panel-margin: #{$datepicker-panel-margin};
  --rz-datepicker-header-background-color: #{$datepicker-header-background-color};
  --rz-datepicker-header-color: #{$datepicker-header-color};
  --rz-datepicker-header-padding: #{$datepicker-header-padding};
  --rz-datepicker-header-line-height: #{$datepicker-header-line-height};
  --rz-datepicker-header-border: #{$datepicker-header-border};
  --rz-datepicker-footer-padding: #{$datepicker-footer-padding};
  --rz-datepicker-footer-line-height: #{$datepicker-footer-line-height};

  --rz-datepicker-calendar-padding: #{$datepicker-calendar-padding};
  --rz-datepicker-calendar-header-font-size: #{$datepicker-calendar-header-font-size};
  --rz-datepicker-calendar-header-text-transform: #{$datepicker-calendar-header-text-transform};
  --rz-datepicker-calendar-header-color: #{$datepicker-calendar-header-color};
  --rz-datepicker-calendar-font-size: #{$datepicker-calendar-font-size};
  --rz-datepicker-calendar-color: #{$datepicker-calendar-color};
  --rz-datepicker-calendar-hover-color: #{$datepicker-calendar-hover-color};
  --rz-datepicker-calendar-hover-background-color: #{$datepicker-calendar-hover-background-color};
  --rz-datepicker-calendar-selected-color: #{$datepicker-calendar-selected-color};
  --rz-datepicker-calendar-selected-background-color: #{$datepicker-calendar-selected-background-color};
  --rz-datepicker-calendar-selected-hover-color: #{$datepicker-calendar-selected-hover-color};
  --rz-datepicker-calendar-selected-hover-background-color: #{$datepicker-calendar-selected-hover-background-color};
  --rz-datepicker-calendar-border: #{$datepicker-calendar-border};
  --rz-datepicker-calendar-border-radius: #{$datepicker-calendar-border-radius};
  --rz-datepicker-calendar-transition: #{$datepicker-calendar-transition};

  --rz-datepicker-calendar-today-color: #{$datepicker-calendar-today-color};
  --rz-datepicker-calendar-today-background-color: #{$datepicker-calendar-today-background-color};
  --rz-datepicker-calendar-today-box-shadow: #{$datepicker-calendar-today-box-shadow};
  --rz-datepicker-calendar-today-border-radius: #{$datepicker-calendar-today-border-radius};

  --rz-datepicker-title-height: #{$datepicker-title-height};

  --rz-timepicker-background-color: #{$timepicker-background-color};
  --rz-timepicker-color: #{$timepicker-color};
  --rz-timepicker-separator-color: #{$timepicker-separator-color};
  --rz-timepicker-padding: #{$timepicker-padding};
  --rz-timepicker-hour-padding: #{$timepicker-hour-padding};
  --rz-timepicker-button-background-color: #{$timepicker-button-background-color};
  --rz-timepicker-button-color: #{$timepicker-button-color};
  --rz-timepicker-button-width: #{$timepicker-button-width};
  --rz-timepicker-button-height: #{$timepicker-button-height};
  --rz-timepicker-button-border-radius: #{$timepicker-button-border-radius};
  --rz-timepicker-button-padding: #{$timepicker-button-padding};
  --rz-timepicker-gap: #{$timepicker-gap};
  --rz-timepicker-separator-margin: #{$timepicker-separator-margin};
  --rz-timepicker-border: #{$timepicker-border};
}

.rz-calendar {
  display: inline-block;
  position: relative;

  .rz-readonly {
      cursor: pointer;
  }

  .rz-inputtext {
    @extend %input;
    width: 100%;
    line-height: var(--rz-datepicker-line-height);
    padding-right: calc(1rem + var(--rz-datepicker-trigger-icon-width));
  }

  &:not(.rz-state-disabled) {
    &:hover {
      .rz-datepicker-trigger {
        box-shadow: none;
        color: var(--rz-datepicker-trigger-icon-hover-color);
      }
    }
  }

  &.rz-state-disabled {
    .rz-inputtext {
      @extend %input-disabled;
    }
  }
}

.rz-calendar-inline {
  background-color: var(--rz-datepicker-panel-background-color);
  border: var(--rz-input-border);
}

.rz-datepicker-trigger {
  box-shadow: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 0.625rem;
  background-color: transparent;
  padding: 0;
  vertical-align: text-top;

  &.rz-state-disabled {
    border: none;
    box-shadow: none;
    cursor: initial;
  }

  color: var(--rz-datepicker-trigger-icon-color);
  width: var(--rz-datepicker-trigger-icon-width);
  height: var(--rz-datepicker-trigger-icon-height);
  font-size: var(--rz-datepicker-trigger-icon-height);

  &:not(.rz-state-disabled) {
    &:hover {
      &:not(:active),
      &:active {
      background-color: transparent;
      }
    }

    &:active {
      box-shadow: none !important;
      background-image: none !important;
    }
  }

  .rzi-calendar,
  .rzi-time {
    font-size: inherit;
    vertical-align: top;
  }

  .rzi-calendar:before {
    content: 'calendar_today';
  }

  .rzi-time:before {
    content: 'schedule';
  }

  .rz-button-text {
    display: none;
  }
}

.rz-datepicker {
  &:not(.rz-datepicker-inline) {
    box-sizing: content-box;
    margin: var(--rz-datepicker-panel-margin);
    position: absolute;
    border: var(--rz-datepicker-panel-border);
    box-shadow: var(--rz-datepicker-panel-shadow);
    border-radius: var(--rz-border-radius);
  }

  background-color: var(--rz-datepicker-panel-background-color);
}

.rz-calendar {
  display: inline-block;
}

.rz-datepicker-inline {
  position: static;

  .rz-datepicker-group {
    display: inline-block;
  }
}

.rz-datepicker-header {
  position: relative;
  line-height: var(--rz-datepicker-header-line-height);

  background-color: var(--rz-datepicker-header-background-color);
  border-bottom: var(--rz-datepicker-header-border);
  color: var(--rz-datepicker-header-color);
  padding: var(--rz-datepicker-header-padding);
}

.rz-datepicker-prev {
  float: left;
  height: var(--rz-datepicker-header-line-height);

  .rzi-chevron-left {
    vertical-align: text-top;
    color: var(--rz-datepicker-header-color);
    &:before {
      content: 'chevron_left';
    }
  }
}

.rz-datepicker-next {
  float: right;
  height: var(--rz-datepicker-header-line-height);

  .rzi-chevron-right {
    vertical-align: text-top;
    color: var(--rz-datepicker-header-color);
    &:before {
      content: 'chevron_right';
    }
  }
}

.rz-datepicker-title {
  height: var(--rz-datepicker-title-height);
  text-align: center;
}

.rz-datepicker-calendar {
  table-layout: fixed;
  border-collapse: collapse;

  th {
    font-weight: normal;
    font-size: var(--rz-datepicker-calendar-header-font-size);
    text-transform: var(--rz-datepicker-calendar-header-text-transform);
    color: var(--rz-datepicker-calendar-header-color);
    padding: var(--rz-datepicker-calendar-padding);
    text-align: center;
  }

  td {
    text-align: center;
    border-top: var(--rz-datepicker-calendar-border);
    padding: 0;

    .rz-state-default {
      display: block;
      padding: var(--rz-datepicker-calendar-padding);
      color: var(--rz-datepicker-calendar-color);
      font-size: var(--rz-datepicker-calendar-font-size);
      border-radius: var(--rz-datepicker-calendar-border-radius);
      transition: var(--rz-datepicker-calendar-transition);

      &.rz-datepicker-today {
        color: var(--rz-datepicker-calendar-today-color);
        background-color: var(--rz-datepicker-calendar-today-background-color);
        box-shadow: var(--rz-datepicker-calendar-today-box-shadow);
        border-radius: var(--rz-datepicker-calendar-today-border-radius);
      }

      &:hover {
        text-decoration: none;
        color: var(--rz-datepicker-calendar-hover-color);
        background-color: var(--rz-datepicker-calendar-hover-background-color);
        cursor: pointer;
      }
    }

    .rz-state-active,
    .rz-state-active.rz-datepicker-today {
      color: var(--rz-datepicker-calendar-selected-color);
      background-color: var(--rz-datepicker-calendar-selected-background-color);
      padding: var(--rz-datepicker-calendar-padding);
      box-shadow: none;

      &:hover {
        color: var(--rz-datepicker-calendar-selected-hover-color);
        background-color: var(--rz-datepicker-calendar-selected-hover-background-color);
      }
    }
  }

  .rz-state-disabled {
    opacity: 0.5;
  }
  
  .rz-datepicker-other-month {
    opacity: 0.5;
  }
}

.rz-datepicker-footer {
    position: relative;
    line-height: var(--rz-datepicker-footer-line-height);
    padding: var(--rz-datepicker-footer-padding);
}

.rz-timepicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rz-timepicker-gap);
  border-top: var(--rz-datepicker-calendar-border);
  padding: var(--rz-timepicker-padding);
  color: var(--rz-timepicker-color);

  .rzi-chevron-up {
    &:before {
      content: 'expand_less';
    }
  }

  .rzi-chevron-down {
    &:before {
      content: 'expand_more';
    }
  }

  .rz-separator {
    color: var(--rz-timepicker-separator-color);
    a {
      display: none;
    }
  }

  .rz-button-md {
    padding: var(--rz-timepicker-button-padding);
    text-transform: uppercase;
  }
}

.rz-hour-picker,
.rz-minute-picker,
.rz-second-picker {
  background-color: var(--rz-timepicker-background-color);
  width: 4rem;
}

.rz-ampm-picker a {
  text-decoration: none;
}